<!DOCTYPE html>
<html>
	<head>
		<title>精品推荐</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<link href="https://www.xizhe.com/statics/css/item.css" rel="stylesheet" type="text/css">
		<script src="https://www.22taoke.com/statics/js/jquery.min.2.2.4.js"></script>
		<script type="text/javascript"  src="https://www.22taoke.com/statics/js/clipboard.min.js"></script>
	</head>
	<body id="wrap">
		<div class="thumb"></div>
		<div class="password">
			<div class="hd">长按 &gt; 复制 &gt; 打开购物APP</div>
			<div class="bd">加载中...</div>
		</div>
		<div class="button"></div>
		<div class="home"></div>
	<script>
	    //复制部分
	    var clipboard = new Clipboard('#itemcopy');
	    clipboard.on('success', function(e) {
	        $("#itemcopy").val('复制成功，打开购物APP').addClass('gold');
	        setTimeout("$('#itemcopy').val('一键复制').removeClass('gold');",3000);
	    });
	    clipboard.on('error', function(e) {
	        $("#itemcopy").val('复制失败，长按文字复制').addClass('red');
			setTimeout("$('#itemcopy').val('一键复制').removeClass('red');",3000);
	    });

	    function GetRequest() {
	        var url = location.search; //获取url中"?"符后的字串
	        var theRequest = new Object();
	        if (url.indexOf("?") != -1) {
	            var str = url.substr(1);
	            strs = str.split("&");
	            for (var i = 0; i < strs.length; i++) {
	                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
	            }
	        }
	        return theRequest;
	    }
	    var Request = new Object();
	    Request = GetRequest();
	    var qid = Request['id']; //id
	    var arr = qid.split('_');
	    sellerid = arr[0];
	    itemId = arr[1];
	    if (sellerid == null || sellerid == undefined || sellerid == "") {
	        sellerid = 0;
	    }
	    if (itemId == null || itemId == undefined || itemId == "") {
	        itemId = 0;
	    }
	    $.ajax({
	        type: "GET",
	        dataType: 'JSON',
	        url: "https://www.xizhe.com/get/coupon?do=show",
	        data: {
				sellerid: sellerid,
	            itemId: itemId
	        },
	        success: function(data) {
	            if (data.success == 1) {
					$('.password .bd').html(data.results.item.password);
	                $('.thumb').html('<img src="'+data.results.item.goods_pic+'_460x460.jpg">');
					$('.button').html('<input type="button" value="一键复制" class="btn"  id="itemcopy" data-clipboard-action="copy" data-clipboard-target=".bd"/>');
					$('.home').html('<div class="link"><a href="'+data.results.share.link+'">进入商城</a></div>');
	            } else {
	            }
	        },
	        error: function() {
	        }
	    }); 
	</script>
	</body>
</html>